/**
 * 
 */

/**
 * @author aheho
 *
 */
public class Shape extends View {

	/**
	 * @param x_
	 * @param y_
	 * @param w_
	 * @param h_
	 * @param p
	 */
	  int type;
	  boolean clickable;
	  SizeWindow sizeWindow;
	  int realX;
	  int realY;
	public Shape(float x_, float y_, float w_, float h_, MainView p, int type,boolean clickable) {
		super(x_, y_, w_, h_, p);
		this.type = type;
		this.clickable=clickable;
		this.sizeWindow = new SizeWindow(x,y,200,250,parent,this);
	}
	void drawContent()
	  {
	  if(type == 1){
		  parent.strokeWeight(4);
		  parent.stroke(176,23,31);
		  parent.fill(255);
		  parent.rect(0,0,w,h);
		  parent.noStroke();
	   	}
	  if(type == 2){
		  parent.strokeWeight(4);
		  parent.stroke(67,110,238);
		  parent.fill(255);
		  parent.ellipse(0,0,w,h);
		  parent.noStroke();
	   	}
	  if(type == 3){
		  parent.strokeWeight(4);
		  parent.stroke(176,23,31);
		  parent.fill(255);
		  parent.rect(0,0,w,h);
		  parent.noStroke();
	   	}
	  }
	boolean contentDragged(float lx, float ly){
		if(!parent.getDraggingShape()&& !this.clickable){
		System.out.println("Dragging");
		parent.setDraggedShape(new Shape(this.x, this.y, this.w, this.h, this.parent, this.type, true));
		parent.setDraggingShape(true);
		}
		if(!parent.getDraggingShape()&& this.clickable){
			System.out.println("Dragging");
			parent.setDraggedShape(this);
			parent.setDraggingShape(true);
			}
		return true;
	}
	boolean contentPressed(float lx, float ly)
	  {System.out.print("Clicking");
		if(clickable){
			System.out.print("Clicking");
			this.sizeWindow.x = parent.mouseX;
			this.sizeWindow.y=parent.mouseY;
			parent.mainView.subviews.add(this.sizeWindow);
		/*	System.out.print("Want view 5");
			parent.view = 5;
			parent.changeView();
			*/
		}
		return true;
	  }
	  

}
